package com.itcast.demo.configurationitem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PreDestroy, @PostConstruct
 */
@RestController
@RequestMapping("/testapp")
public class TestEntity {

    @Autowired
    private Entity entity;

    @RequestMapping("/test")
    public void test() {
        System.out.println(entity);
    }

    @GetMapping("/test2")
    public ResponseEntity test2() {
        System.out.println(entity);
        ResponseEntity<Entity> responseEntity = ResponseEntity
                .status(HttpStatusCode.valueOf(200))
                .body(entity);
        return responseEntity;
    }
}
